﻿-var entity = ViewData["entity"] as Status
-bool create = (entity.Id == 0);
%form.validate{action="status.ivp/save",method="post",enctype="multipart/form-data"}
  _formfields
  =HTMLHelper.HiddenInput("id",entity.Id)
  #content
    .formheader
      %h1=(create)? "<img src=\"img/headericons/service.gif\" width=\"24\" height=\"24\" /> Новый статус" : String.Format("<img src=\"img/statuses/{0}\" class=\"icon24\" /> {1}",entity.Image24,entity.Name)
    _error
    .formbody
      .field
        %label.required{for="name"} Название
        %input#name.px500.big.required{name="name",value=HTMLHelper.EscapeQuotes(entity.Name),maxlength="50"}
      .field
        %label.required{for="actionname"} Действие
        %input#actionname.px500.big.required{name="actionname",value=HTMLHelper.EscapeQuotes(entity.ActionName),maxlength="50"}
      .field
        %label{for="description"} Описание
        %textarea#description.px500{name="description",rows="5",maxlength="1000"}=entity.Description
      %div
        %label.radio{for="isfinal"} 
          =HTMLHelper.Checkbox("isfinal","True","",entity.IsFinal)
          ="Конечный"
      .spacer10
      .field
        -if(!create)
          %span Картинки:
            =string.Format("<img src=\"img/statuses/{0}\" class=\"icon24\" /><img src=\"img/statuses/{1}\" class=\"icon16\" />",entity.Image24,entity.Image16)
          #changefiletrg
            %a{href="#",onclick="javascript:$('#changefiletrg').hide();$('#changefile').show();$('#file24').attr('disabled',false);$('#file16').attr('disabled',false); return false;"} Изменить картинки
        #changefile{class=(create)?"":"hidden"}
          %label{for="file",class=(create)?"required":""} Большая картинка <sup>Размер 24х24</sup>
          %input#file24{type="file",name="file24",disabled="true",class=(create)?"required":""}
          %label{for="file",class=(create)?"required":""} Маленькая картинка <sup>Размер 16х16</sup>
          %input#file16{type="file",name="file16",disabled="true",class=(create)?"required":""}
    .formbottom
      %div
        %button.saveandreturn#submit{type="submit",onclick="$('#returnaftersave').val('true')"} Сохранить и вернуться
        %button.save#submit{type="submit",onclick="$('#returnaftersave').val('')"} Сохранить
        %button.return{type="button",onclick="closeForm();"} Вернуться
  #rightmenu
    _configurationmenu
